package zx.x.modules.sys.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zx.x.modules.sys.service.IntroduseService;
import zx.x.modules.x.entity.IntroduseEntity;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;



/**
 * 
 *
 * @author x
 * @email x
 * @date 2022-02-24 16:25:38
 */
@RestController
@RequestMapping("/introduse")
public class IntroduseController {
    @Autowired
    private IntroduseService introduseService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("x:introduse:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = introduseService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("x:introduse:info")
    public R info(@PathVariable("id") Integer id){
		IntroduseEntity introduse = introduseService.getById(id);

        return R.ok().put("introduse", introduse);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("x:introduse:save")
    public R save(@RequestBody IntroduseEntity introduse){
		introduseService.save(introduse);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("x:introduse:update")
    public R update(@RequestBody IntroduseEntity introduse){
		introduseService.updateById(introduse);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("x:introduse:delete")
    public R delete(@RequestBody Integer[] ids){
		introduseService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
